import { defineStore } from 'pinia';
// import { useFilmReadLeft } from '@/store';
// import { commonList } from '@/api/common/common';
import type * as Type from './type';

const useFilmReadRight = defineStore('frPageRight', {
  state: (): Type.FilmReadRight => ({
    seriesSettings: {
      formId: 0,
      form: {
        // 1075: "",      //componentCode
        // 1018: "",
        // 1003: [],      // componentType  checkbox child_select []
      },
      formOptions: [ 
        // {
        //   type: componentType,
        //   title: "", //componentName
        //   required: false,      //required
        //   field: "1075",    //componentCode
        //   data: "",      //componentData  { value: "", label: "", child: [] }
          
        //   id: 1075,     //componentId
        // },
      ]
    },
    currentMiniSeriesSet: {
      formId: 0,
      form: {
      //   1075: "",
      //   1018: "",
      //   1003: [],      // componentType  checkbox child_select []
      },
      formOptions: [ 
        // {
        //   type: componentType,
        //   title: "", //componentName
        //   required: false,      //required
        //   field: "1075",    //componentCode
        //   data: "",      //componentData  { value: "", label: "", child: [] }
          
        //   id: 1075,     //componentId
        // },
      ]
    },
    currentSubmenuItem: '',
    findingVisible: false,
    findingValue: '',
    diagnosisVisible: false,
    diagnosisValue: '',
    rejectFilmVisible: false,
    rejectFilmValue: '',
    scrapList: []
  }),
  actions: {
    setState(partial: Type.FilmReadRight) {
      this.$patch(partial);
    },
    // 获取废片数据集合
    async fetchScrapList() {
      // 获取废片原因
      // const res = await commonList();
      // const { discardReasons, ...newRes } = res?.data;
      // this.scrapList = discardReasons!;
    },
    // 聚焦当前病灶
    setCurrentItem(id: string) {
      // const FilmReadLeft = useFilmReadLeft();
      // this.currentSubmenuItem = id;
      // FilmReadLeft.showLesionList.map(item => {
      //   item.disease.id === +id && (this.currentMiniSeriesSet = item.disease.seriesList);
      // })
    }
  }
});

export default useFilmReadRight;